import os
import tornado
from tornado import gen
from tornado.options import options

class PathBuilder:
    @staticmethod
    def get_labs_dir_for_student(accountname):
        data_root_dir = tornado.options.options.data_root_dir
        data_student = tornado.options.options.data_student
        data_student_lab = tornado.options.options.data_student_lab
        return os.path.join(data_root_dir, data_student, accountname, data_student_lab)

    @staticmethod
    def get_lab_work_dir_for_student(accountname, labcode):
        return os.path.join(PathBuilder.get_labs_dir_for_student(accountname), labcode)

    @staticmethod
    def get_library_dir_for_lab(labcode):
        data_root_dir = tornado.options.options.data_root_dir
        data_library = tornado.options.options.data_library
        return os.path.join(data_root_dir, data_library, labcode)
    
    @staticmethod
    def get_virtual_env_dir_for_student(accountname):
        data_root_dir = tornado.options.options.data_root_dir
        data_student = tornado.options.options.data_student
        data_student_virtualenv = tornado.options.options.data_student_virtualenv
        return os.path.join(data_root_dir, data_student, accountname, data_student_virtualenv)